﻿using System;
using System.IO;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

namespace Sizebox.CharacterEditor
{
	// Token: 0x0200025C RID: 604
	public class PresetsFileEntryGui : MonoBehaviour, IPointerClickHandler, IEventSystemHandler
	{
		// Token: 0x17000188 RID: 392
		// (get) Token: 0x06000D34 RID: 3380 RVA: 0x0006926E File Offset: 0x0006746E
		// (set) Token: 0x06000D35 RID: 3381 RVA: 0x00069276 File Offset: 0x00067476
		public string FilePath { get; private set; }

		// Token: 0x17000189 RID: 393
		// (get) Token: 0x06000D36 RID: 3382 RVA: 0x0006927F File Offset: 0x0006747F
		// (set) Token: 0x06000D37 RID: 3383 RVA: 0x00069287 File Offset: 0x00067487
		public bool Selected
		{
			get
			{
				return this._Selected;
			}
			set
			{
				this._Selected = value;
				if (this._Selected)
				{
					this.background.color = this.selectedColor;
				}
				else
				{
					this.background.color = this.unselectedColor;
				}
			}
		}

		// Token: 0x06000D38 RID: 3384 RVA: 0x000692C2 File Offset: 0x000674C2
		private void Awake()
		{
			this.background.color = this.unselectedColor;
		}

		// Token: 0x06000D39 RID: 3385 RVA: 0x000692D5 File Offset: 0x000674D5
		public void Initialize(string filePath)
		{
			this.FilePath = filePath;
			this.SetName(Path.GetFileName(filePath));
		}

		// Token: 0x06000D3A RID: 3386 RVA: 0x000692EA File Offset: 0x000674EA
		private void SetName(string name)
		{
			this.text.text = "-  " + name;
		}

		// Token: 0x06000D3B RID: 3387 RVA: 0x00069302 File Offset: 0x00067502
		public void OnPointerClick(PointerEventData eventData)
		{
			base.GetComponentInParent<BasePresetsView>().SetTarget(this);
		}

		// Token: 0x04001238 RID: 4664
		[SerializeField]
		private Text text;

		// Token: 0x04001239 RID: 4665
		[SerializeField]
		private Image background;

		// Token: 0x0400123A RID: 4666
		[SerializeField]
		private Color selectedColor;

		// Token: 0x0400123B RID: 4667
		[SerializeField]
		private Color unselectedColor;

		// Token: 0x0400123C RID: 4668
		private const string PREFIX = "-  ";

		// Token: 0x0400123E RID: 4670
		private bool _Selected;
	}
}
